package system.service.impl;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import system.entity.Carousel;
import system.entity.SysUser;
import system.mapper.BaseMapper;
import system.mapper.SysUserMapper;
import system.service.CarouselService;
@Data
/**
 * 轮播图业务层实现类
 * @author admin
 */
@Component //bean id则为类的小写carouselServiceImpl

public class CarouselServiceImpl implements CarouselService {
    /**
     * 注入持久层对象
     */
//    @Autowired// 自动注入 相当于在bean上加入autowire属性，会在当前类型中自动加入set或者构造方法来完成注入
//    private CarouselMapper carouselMapper;
    @Autowired
    @Qualifier("carouselMapper")
    private BaseMapper baseMapper;

//    public void setCarouselMapper(CarouselMapper carouselMapper) {
//        this.carouselMapper = carouselMapper;
//    }

    /**
     * 新增轮播图
     * @param carousel
     * @return
     */

    @Override
    public int insertCarousel(Carousel carousel) {
//       //  最古老的方式：
//        carouselMapper = new CarouselMapper();
        SysUser sysUser = new SysUser();
        sysUser.setNickName("张三");
       return baseMapper.insert(carousel);
    }
}